package com.jt.controller;

import com.jt.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller //SpringMVC专门扫描的注解
public class HelloController {

    @RequestMapping("/hello")
    @ResponseBody //返回JSON串,json本质是字符串
    public String hello() {
        return "你好,SpringMVC";
    }

    @RequestMapping("/getUser")
    @ResponseBody
    public User getUser() {
        User user = new User();
        user.setId(101);
        user.setName("Jack love 三上teacher body");
        return user;
    }
}
